<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Request;

class UserStoreFormRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {


        return [
            'name' => 'required',
            'mobile' => 'required|digits:11|unique:users,mobile',
            'code' => 'required',
            'password' => 'required|confirmed',
            'password_confirmation' => 'required',
            'agree' => 'accepted'

        ];

    }

    public function messages()
    {
        return [
            'mobile.digits' => '请输入有效手机号',
            'agree.accepted' => '请同意服务条款'
        ];
    }
}
